import 'package:cotton_candy/utils/net.dart';
import 'package:flutter/cupertino.dart';

class UserService {
  static Future<_LoginModal> login({
    @required String username,
    @required String password,
  }) async {
    final data = {"username": username, "password": password};
    final response = await net().post('/register', data: data);
    if (response.data['success']) {
      return _LoginModal(success: true);
    }
    return _LoginModal(success: false, message: response.data['message']);
  }
}

class _LoginModal {
  bool success;
  String message;
  _LoginModal({@required this.success, this.message});
}
